1. Field of the Invention
The present invention relates to a 3 dimensional (D) graphic accelerator and a method for processing a graphic acceleration using the same.
2. Description of the Related Art
In general, 3D computer graphics is a core part of constructing an environment of multimedia. In order to assist in a vivid 3D image, however, an exclusive 3D graphic accelerator of high performance is required. Highly efficient 3D graphic accelerators are introduced these days to PCs and game devices, and active studies are under way for 3D graphic accelerators.
FIG. 1 is a block diagram illustrating the processing steps of the 3D graphics. Referring to FIG. 1, the processing steps of the 3D graphics comprises a real-time hardware acceleration by a 3D application software in a 3D graphic accelerator through an application program interface (API), and a transfer of the result to the display.
The above 3D graphic accelerator mainly functions as geometry processing and rendering. The geometry processing is a process of converting an object on a 3D coordinate into a viewpoint, and projecting the viewpoint onto a 2D screen coordinate. The rendering is a process of determining a color value of the 2D coordinate and storing the value in a frame buffer. The color value stored in the frame buffer after processing all the 3D data inputted to one frame is transferred to a display, which is called a xe2x80x9cdisplay refresh.xe2x80x9d In general, a geometry processing section and a rendering section are pipelined to enhance their performance.
The 3D graphic accelerators are roughly divided into two styles of following an order of inputted primitives, i.e., an object-order style and an image-order style.
The primitives here refer to dots, lines and polygons. In most of the applicable fields in general, polygons occupy most of the primitives. A hardware accelerator is constructed to process the polygons at high speed.
The object-order style is a style that the objects are transferred to a display in the order of primitives after undergoing the geometrical process and rendering process. The object-order style is advantageous for high performance because it can pipeline the geometrical process and the rendering process performed per primitive.
For a hidden surface removal, however, the object-order style needs to have a depth buffer (z-buffer) and a color-buffer corresponding to a full screen. For an overlap of the rendering process and the display refresh, two z-buffers and two color buffers are required. This is called a double buffering. Most of the 3D graphic accelerators currently being introduced to public perform the processing in the object-order style.
The image-order style is not a style of processing the image in the order of primitives but of processing the primitives at the corresponding positions of the images in the order of the positions.
Assuming that the start point of the screen is (0, 0) and the end point is (nxe2x88x921, mxe2x88x921), for instance, all of the related primitives at the position of (0, 0) are searched for calculation of color values. The same process is repeated in the given order until reaching to the position of (nxe2x88x921, mxe2x88x921). This necessitates a buffer that has a pipeline of the geometrical process and the rendering process for entire primitives and all the information on the geometrically processed primitives. Since only a part of the screen rather than a full screen is required for the hidden surface removal, the image-order style is more advantageous for lowering the price than for enhancing the performance. The 3D graphic accelerator of this style had been mainly adopted in the past.
The following is a comparative explanation between the object-order style and the image-order style made with reference to FIG. 2.
FIG. 2 shows triangles consisting of A, B, C and D, E, F. Assume that, of the two triangles, the one consisting of A, B, C is defined earlier than the one consisting of D, E, F and first inputted to the 3D graphic accelerator. According to the object-order style, the information on colors and depths generated from the geometrical process and the rendering process through a 3D graphic pipeline with respect to the triangle consisting of A, B, C is stored in a frame buffer. As a next step, information on the colors and the depths is calculated in the geometrical process and the rendering process with respect to the triangle consisting of D, E, F. The calculated information is compared with the information on the depths of the triangle A, B, C already stored with respect to the overlapping interval, and the information closer to the viewpoint is selected and stored. FIG. 2 shows an occasion where an overlapping interval exists with respect to the two triangles and the one consisting of D, E, F is closer to the viewpoint than the one consisting of A, B, C with respect to the overlapping interval.
According to the image-order style, the processing order of the triangles depends on the position of the image currently being processed.
For instance, if the position currently being processed according to the image-order style in FIG. 2 is the kth scan-line, the values in the X axis are processed in a reverse order of the numerical values. Subsequently, all the triangles corresponding to the pixel currently being processed are searched irrespective of an input order of the triangles, and the one closest to the viewpoint is selected for calculation of the ultimate color values. In other words, when the value in the X axis is the kth scan-line, the triangle consisting of A, B, C is processed within the interval corresponding to the triangle consisting of A, B, C except within the overlapping interval. Of the two triangles, the position closer to the viewpoint (the triangle consisting of D, E, F in FIG. 2) is searched and processed within the overlapping interval. The triangle consisting of D, E, F is processed in the remaining interval corresponding to the triangle consisting of D, E, F.
Meanwhile, the most outstanding image-order style is a scan-line style, as shown in FIG. 3.
Still referring to FIG. 3, in the geometrical process, all the primitives are geometrically processed according to the viewpoint, and are transferred to the position on the screen. The pertaining information is stored in buckets existing per scan-line. This means that the buckets are supposed to have all the information pertaining to the primitives corresponding to the corresponding scan-lines. This is called a xe2x80x9cbucket sorting.xe2x80x9d Such a bucket sorting is a part to be processed by a geometrical processing section or a separate device. The rendering process is performed upon completion of the geometrical process and storage of the information pertaining to all the primitives in the buckets existing per scan-line. The rendering process is performed in a predetermined order of scan-lines.
Assume that the rendering process is performed from the 0th scan-line to the final nxe2x88x921th scan-line, as illustrated in FIG. 3, for instance, and the currently being processed scan-line is the kth, and the (x, y) position on the screen of the kth scan-line begins from (0, k) and ends with (m, k). Then, the primitives corresponding to the position (0, k) is first searched from the buckets and the one closest to the viewpoint is selected for calculation of an ultimate color value, according to the scan-line style. If such a process is performed to the (m, k) position, the rendering process per scan-line is completed, and the information rendered on a scan-line is transferred for a display refresh. The same process is performed with respect to the k+1th scan-line, which corresponds to the next scan-line, and to the entire scan-lines.
The following are the characteristic features of the image-order style.
First, a huge memory space is required to retain information in buckets allotted per scan-line in proportion to an increase of the number of primitives.
Second, whereas the object-order style requires a z-buffer for a full screen, the scan-line style requires a z-buffer corresponding to the scan-line only.
Third, the information on all the primitives corresponding to each pixel is available from the buckets allotted per scan-line. In particular, the order of primitives is available with respect to the viewpoint. Therefore, the image-order style can provide an order-independent transparency.
The order-independent transparency plays a very significant role in the 3D graphic accelerator because a transparent primitive is critical for generation of a vivid 3D graphic image. However, an order-dependency problem is raised when processing a transparent primitive.
The following is a more detailed explanation in that regard.
FIG. 4 is an example showing the order-dependency problem caused when a plurality of primitives are stretched over one pixel. Assume that A is transparent, B is blue and opaque, and C is red and opaque. When the ultimate color value needs to be blue in that case, the order-dependency problem is raised if the primitives are inputted in the order of C-A-B, as shown in FIG. 4. In other words, when C is inputted first, the color value becomes red. When A is inputted next, the color value becomes red due to its transparency. When B is inputted next, B is discarded because A is the closest to the viewpoint. Thus, the ultimate color value becomes red.
This problem of order-dependency can be solved by the image-order style owing to its structural merits because it stores the information on the entire primitives stretched over each pixel. To be specific, even if the primitives are inputted in the order of C-A-B, as mattered in the object-order style, the image-order style stores the information on C, A, B in the buckets, and processes the primitives in the order of C-B-A in the rendering process so as to calculate a correct color value.
However, the image-order style also poses a problem of being incompatible with a 3D graphic accelerator of high performance. While having a merit of processing the 3D graphics at high speed, the object-order style fails to provide an order-independent transparency due to processing of the graphics in the order of input of the primitives. On the other hand, the image-order style provides an order-independent transparency owing to processing of the primitives in the order of positions of each image corresponding to a primitive. However, the image-order style still fails in a speed.
To solve the above problems, an object of the present invention is to provide a 3D graphic accelerator of high speed and a method for processing a graphic acceleration using the same
To achieve the above object, a method for processing a graphic acceleration using the 3D graphic accelerator according to the present invention comprises the following steps: a first step of geometrically processing the inputted primitives; a second step of determining an existence of any transparent primitives among the geometrically processed ones or a dominance/rarity of opaque primitives; a third step of rendering the primitives determined in the second step in the object-order style and the image-order style to store the rendered information thereon in the corresponding frame buffers and buckets, respectively; and a fourth step of display-refreshing the rendered primitives.
If any transparent primitives among the geometrically processed ones are determined to exist or/and opaque primitives are determined to be dominant at the third step, the third step is further divided into the following sub-steps of: (a) bucket-sorting so that the information on a part of the opaque primitives or/and the transparent primitives can be stored in the corresponding first bucket, respectively, and (b) storing the information in the first frame buffer after rendering remainders of the opaque primitives in the object-order style; (c) determining as to completion of the bucket-sorting and the rendering in the object-order style of the remainders of the opaque primitives; and (d) rendering a part of the bucketed opaque primitives or/and transparent primitives in the image-order style, when the rendering in the object order style of the remainders of the opaque primitives is determined to have been completed, and (e) comparing the values between the information rendered in the image-order style and in the object-order style to store the resultant value in the first frame buffer.
While rendering a part of the bucketed opaque primitives or/and transparent primitives in the image-order style, for a determination of completion of the performance in the above sub-steps, an existence of any transparent primitives among the geometric primitives that are inputted or a dominance/rarity of the opaque primitives is determined. Bucket-sorting is performed upon determination of the dominance/rarity of the opaque primitives so that the information on the part of the opaque primitives or/and transparent primitives can be stored in the corresponding second bucket, respectively. The remainders of the opaque primitives are rendered in the object-order style and the pertaining information is stored in the second frame.
If no transparent primitive among the geometrically processed ones is determined to exist and opaque primitives are determined to be rare at the third step, the third step is further divided into the following sub-steps: storing the information in the second frame buffer after rendering the information on the opaque primitives in the object-order style; determining as to completion of the rendering in the object-order style; and rendering the bucketed opaque primitives in the image-order style when the rendering is determined to have been completed.